<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAmountTransfersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('amount_transfers', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('order_no')->nullable()->default('')->comment('订单号');
            $table->integer('from_user_id')->default(0)->comment('转让人');
            $table->integer('to_user_id')->default(0)->comment('接收人');
            $table->decimal('price', 10, 2)->default(0)->comment('转让金额');
            $table->decimal('handle_fee', 5, 2)->default(0)->comment('手续费');
            $table->string('image')->nullable()->default('')->comment('付款图片');
            $table->tinyInteger('status')->nullable()->default(0)->comment('状态');
            $table->timestamps();
            $table->index(['from_user_id']);
            $table->index(['to_user_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('amount_transfers');
    }
}
